<!DOCTYPE html>
<html lang="zh-CN">
	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no,minimum-scale=1.0, maximum-scale=1.0" />
		<title>限时优惠券抢购</title>
		<link rel="stylesheet" href="//cdn.yafangwanhui.com/0depository/modules/css/livestreaming/index.css" />
		<link href="//cdn.yafangwanhui.com/0depository/modules/css/layui/new/layui.css" rel="stylesheet" />
		<script src="//cdn.yafangwanhui.com/0depository/modules/css/layui/new/layui.js"></script>

		<style>
			.layui-icon-close:before {
				content: "X";
			}

			.layui-layer-shade {
				opacity: 0.6 !important;
			}

			body {
				position: relative;
				height: 100vh;
				overflow: hidden;
				display: flex;
				align-items: center;
				justify-content: center;
			}

			.bg-image {
				position: absolute;
				top: 0;
				left: 0;
				width: 100%;
				height: 100%;
				/* background-image: url("//cdn.yafangwanhui.com/0depository/images/0312/96d4f1e8-918d-4eac-9e0f-675ff142f66f.jpg"); */

				background-size: cover; /* 让背景图片铺满整个屏幕 */
				background-repeat: no-repeat; /* 防止背景图片重复 */
				background-position: center; /* 将背景图片居中 */
			}

			.showmodel {
				position: absolute;
				width: calc(100% - 2.8rem);
				background: rgba(222, 203, 255, 0.34);
				box-sizing: border-box;
				border: 1px solid #ffffff;
				backdrop-filter: blur(2rem);
				border-radius: 2.5rem;
				padding: 2.4rem;
				margin-top: 34.5rem;
			}

			.yftelephone .title,
			.yfusername .title {
				font-weight: 600;
				color: #3d3d3d;
			}

			.showmodel .phone {
				margin-top: 0.6rem;
				border-radius: 0.8rem;
				-webkit-border-radius: 0.8rem;
				-moz-border-radius: 0.8rem;
				-ms-border-radius: 0.8rem;
				-o-border-radius: 0.8rem;
				height: 4.6rem;
				padding: 1.2rem;
				box-sizing: border-box;
				background: #f8f8f8;
				border: none;
				width: 100%;
			}

			.showmodel .yfsubmit {
				width: 100%;
				background: #f8733c;
				width: 100%;
				box-sizing: border-box;
				margin: 0 auto;
				margin-top: 4.3rem;
				text-align: center;
				line-height: 5.2rem;
				font-size: 1.8rem;
				color: #ffffff;
				border-radius: 21.4rem;
			}

			.yfsubmit {
				box-shadow: inset 0px -0.4rem 0px 0px #d1451f;
			}

			.actived {
				background-color: #ccc !important;
				box-shadow: none !important;
			}

			.active {
				box-shadow: inset 0px -0.4rem 0px 0px #d1451f !important;
				background: #f8733c !important;
			}

			@media only screen and (min-width: 1029px) {
				html,
				body {
					width: 677px;
				}
			}
		</style>
	</head>
	<body>
		<img src="//cdn.yafangwanhui.com/0depository/images/0312/96d4f1e8-918d-4eac-9e0f-675ff142f66f.jpg" alt="" style="width: 100%; height: 100%" />
		<div class="showmodel">
			<div class="yftelephone">
				<div class="title">联系电话</div>
				<input type="text" name="title" required lay-verify="required" placeholder="请输入您的手机号码" autocomplete="off" class="phone" id="savephone" />
			</div>

			<div class="yfusername" style="margin-top: 2.4rem">
				<div class="title">联系人姓名</div>
				<input type="text" name="title" required lay-verify="required" placeholder="请输入您的姓名" autocomplete="off" class="phone" id="username" />
			</div>
			<div style="text-align: center; font-size: 1.4rem; color: #a856ba; margin-top: 1rem; font-weight: 700">*我们将严格保密您的隐私</div>
			<div class="yfsubmit active">提交</div>
			<div class="" style="display: none" lay-on="test-page" id="clickfade"></div>
		</div>
	</body>
	<script src="//cdn.yafangwanhui.com/paycpmall/images/jquery.js"></script>
	<script type="text/javascript">
		function getQueryString(name) {
			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
			var r = window.location.search.substr(1).match(reg);
			if (r != null) {
				return unescape(r[2]);
			}
			return null;
		}

		function getresult() {
			$.post(
				"//pay.yafang2009.com/addons/epay/index/issuccess",
				{
					out_trade_no: getQueryString("a1"),
				},
				function (data) {
					if (data == 1) {
						$(".dianji").hide();
						$("#chaxun").hide();
						$(".yfupdate").show();
					} else {
						alert("支付失败,请返回上一页面重新支付");
						//  window.history.back();location.reload();                             window.location.href="https://pay.yafang2009.com/index.php/index/index/huodong";
					}
				}
			);
		}

		setTimeout("getresult()", 3000);

		$(".dianji").click(function () {
			getresult();
		});
	</script>
	<script>
		var isSubmit = false;
		var yfkhphonenumber = null;
		var yfcaptcha = "";
		let codetext = $("#yfcheckcode");

		layui.use(function () {
			var $ = layui.$;
			var layer = layui.layer;
			var util = layui.util;
			var form = layui.form;
			// 事件
			util.on("lay-on", {
				"test-page": function () {
					layer.open({
						title: "",
						type: 1,
						content: `<div class="showsuccess">
					<img src="//cdn.yafangwanhui.com/0depository/images/11-30/success.png" alt="" />
					<p>提交成功</p>
				</div>`,
					});
				},
			});
		});

		function isPhoneNum(phone) {
			var pattern = /^1[0-9]{10}$/;
			return pattern.test(phone);
		}

		function yfgetQueryString(name) {
			var url_string = window.location.href;
			var params = url_string.split("?")[1];
			if (!params) return null;
			var vars = params.split("&");
			var query_string = {};
			for (var i = 0; i < vars.length; i++) {
				var pair = vars[i].split("=");
				var key = decodeURIComponent(pair[0]);
				var value = decodeURIComponent(pair[1]);
				if (name === key) {
					return value;
				}
			}
			return null;
		}

		function getyfCode(phonenumber) {
			$.post(
				"https://888.yafangwanhui.com/api/zhibosms/send",
				{
					mobile: parseInt(phonenumber),
				},
				function (data) {
					layer.msg(data.msg);
				}
			);
		}

		function submityfcode() {
			$.post(
				"https://888.yafangwanhui.com/api/zhibosms/submitMobilehd",
				{
					mobile: yfkhphonenumber,
					username: username,
					captcha: yfcaptcha,
					out_trade_no: getQueryString("a1"),
				},
				function (data) {
					// layer.msg(data.msg);

					$("#clickfade").trigger("click");
				}
			);
		}

		function yfcountdowntime() {
			codetext.text("60s");
			let codenum = 60;
			let interval = setInterval(() => {
				--codenum;
				codetext.html(`${codenum}s`);
			}, 1000);
			setTimeout(() => {
				clearInterval(interval);
				codetext.text("发送验证码");
			}, 60000);
		}

		$("#yfcheckcode").click(function () {
			yfkhphonenumber = $("#savephone").val();
			if (isPhoneNum(yfkhphonenumber)) {
				yfcountdowntime();
				getyfCode(yfkhphonenumber);
			} else {
				layer.msg("请输入正确的手机号");
			}
		});

		let yfstatus = false;
		$(".yfsubmit").click(function () {
			yfcaptcha = $(".responsecode").val();
			yfkhphonenumber = $("#savephone").val();
			username = $("#username").val();
			if (!yfkhphonenumber || isPhoneNum(yfkhphonenumber) === false) {
				layer.msg("请先输入正确手机号码");
				return false;
			}
			if (!username) {
				layer.msg("请先输入联系姓名");
				return false;
			}
			$(this).removeClass("active").addClass("actived");
			$("#savephone").val("");
			$("#username").val("");
			submityfcode(yfkhphonenumber, yfcaptcha, yfgetQueryString("a1"));
			setTimeout(() => {
				$(this).addClass("active");
			}, 2000);
		});
	</script>
</html>
